/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class Test_Trg_SLA
{

    static testMethod void myUnitTest()
    {
        // TO DO: implement unit test

        //Account Object...
        Account accountObject = new Account();
        accountObject.Name = 'Test Account';
        //accountObject.LicenseNumber__c = serialObject.id;
        accountObject.License_Application_Step__c = 'Record Created';
        accountObject.License_Application_Type__c = 'New License';
        accountObject.Activity__c = 'Trading - Three Activity';
        accountObject.License_Issue_Date__c = system.today();
        accountObject.License_Expiry_Date__c = System.Today().addYears(1);
        insert accountObject;
        
        //SLA Implementation...
        SLA__c slaObject = new SLA__c();
        slaObject.License__c = accountObject.Id;
        slaObject.Actual_Start_Date_Time__c= DateTime.Now();
        slaObject.Expected_End_Date__c= DateTime.Now().addYears(2);
        slaObject.SLA_Hours__c = 100;
        slaObject.Process_Type__c = 'License';
        slaObject.Application_Type__c = 'New License';
        slaObject.Actual_End_Date_Time__c= DateTime.Now().addYears(1);
        upsert slaObject;
        
        
        slaObject.Actual_End_Date_Time__c= DateTime.Now().addYears(2);
        upsert slaObject;        
        
        Suggestion_and_Complaints__c sc = new Suggestion_and_Complaints__c();
        sc.Origin__c = 'New';
        sc.Case_Number__c = '12345';   
        sc.Type__c = 'Suggestion';
        sc.Name__c = 'Mustafa';
        sc.License_Number__c = '12323';
        sc.Company__c = accountObject.Id;
        sc.Mobile_Number__c = '1234566789';
        sc.Email__c = 'xyz@test.com';
        insert sc;
                
        //SLA Implementation...
        SLA__c slaObject1 = new SLA__c();
        slaObject1.Suggestion_and_Complaint__c = sc.Id;
        slaObject1.Actual_Start_Date_Time__c= DateTime.Now();
        slaObject1.Expected_End_Date__c= DateTime.Now().addYears(2);
        slaObject1.SLA_Hours__c = 100;
        slaObject1.Process_Type__c = 'Suggestion';
        slaObject1.Application_Type__c = 'Case';
        slaObject1.Actual_End_Date_Time__c= DateTime.Now().addYears(1);
        upsert slaObject1 ;
        
        sc.Status__c = 'Closed';
        sc.Close_Date_Time__c = DateTime.Now().addYears(2);
        sc.Action_Details__c = '12323232';
        upsert sc;     
        
    
    }
    
    
}